import { fetchApi } from '@/utils'

export const getUserInfo = () => {
	return fetchApi({
		url: '/user/info',
		method: 'POST',
	})
}

export const bindMobile = (data: {
	type: string,
	mobile: string,
	code: string
}) => {
	return fetchApi({
		url: '/wx/sns/bind',
		method: 'POST',
		data
	})
}

export const logout = () => {
	return fetchApi({
		url: '/user/logout',
		method: 'POST',
	})
}

export const setUserInfo = (data: {
	nickname: string,
	avatarUrl: string
}) => {
	return fetchApi({
		url: '/user/setInfo',
		method: 'POST',
		data
	})
}

export const invalidUser = () => {
	return fetchApi({
		url: '/user/close',
		method: 'POST',
	})
}
